-
Notifications
You must be signed in to change notification settings - Fork 2
/
towctrans.c
56 lines (37 loc) · 1.36 KB
/
towctrans.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*++
toro C Library
https://github.com/KilianKegel/toro-C-Library#toro-c-library-formerly-known-as-torito-c-library
Copyright (c) 2017-2024, Kilian Kegel. All rights reserved.
SPDX-License-Identifier: GNU General Public License v3.0
Module Name:
towctrans.c
Abstract:
Implementation of the Standard C function.
Author:
Kilian Kegel
--*/
#include <CdeServices.h>
#include <wctype.h>
#include <_wctype.h>
/** Brief description of the function’s purpose.
Synopsis
#include <wctype.h>
wint_t towctrans(wint_t wc, wctrans_t desc);
Description
The towctrans function maps the wide character wc using the mapping described by
desc. The current setting of the LC_CTYPE category shall be the same as during the call
to wctrans that returned the value desc.
Each of the following expressions behaves the same as the call to the wide character case
mapping function (7.25.3.1) in the comment that follows the expression:
towctrans(wc, wctrans("tolower")) // towlower(wc)
towctrans(wc, wctrans("toupper")) // towupper(wc)
Returns
The towctrans function returns the mapped value of wc using the mapping described
by desc.
@param[in] c character to test
@retval _UPPER if upcase letter
@retval 0 if not
**/
wint_t towctrans(wint_t c, wctrans_t value) {
return value == _UPPER ? towupper(c) : towlower(c);
}